package com.j283_5.wisdom_park.controller.article_management;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.j283_5.wisdom_park.common.result.ResultData;
import com.j283_5.wisdom_park.pojo.Article;
import com.j283_5.wisdom_park.pojo.Visitors;
import com.j283_5.wisdom_park.service.ArticleService;
import com.j283_5.wisdom_park.vo.contract_management.ContractTableVo;
import com.j283_5.wisdom_park.vo.contract_management.CustomerNeedsVo;
import com.j283_5.wisdom_park.vo.contract_management.CustomerVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 文章表 前端控制器
 * </p>
 *
 * @author laoda
 * @since 2022-04-28
 */
@RestController
@RequestMapping("/article")
@Api(value = "文章发布管理",tags = "文章发布管理",produces="冯弋舟")
public class ArticleController {

    @Resource
    private ArticleService articleService;

    /**
     * 多条件查询文章
     * @return
     */
    @RequestMapping(value = "/findArticle" , method = RequestMethod.GET)
    @ApiOperation(value = "查询所有合同信息",notes = "查询所有合同信息（分页）",produces="冯弋舟", response = ResultData.class)
    public ResultData findArticle(@Param("page") Integer page, @Param("limit")Integer limit, @Param("article") Article article){
        List<Article> list=new ArrayList<>();
        Article article1=new Article(1,"对于年龄你焦虑吗","今日热点","小程序","图文","年龄",1,new Timestamp(System.currentTimeMillis()),"src/main/resources/img","近日，碳中和领域国际专业机构碳信托");
        list.add(article1);
        return ResultData.ok().data(list);
    }

    /**
     * 更新文章
     * @return
     */
    @RequestMapping(value = "/updateArticle" , method = RequestMethod.GET)
    @ApiOperation(value = "更新文章",notes = "更新文章",produces="冯弋舟", response = ResultData.class)
    public ResultData updateArticle(@Param("article") Article article){

        return ResultData.ok();
    }


    /**
     * 删除文章信息
     * @return
     */
    @RequestMapping(value = "/deleteArticle" , method = RequestMethod.POST)
    @ApiOperation(value = "删除文章信息",notes = "删除文章信息",produces="冯弋舟", response = ResultData.class)
    public ResultData DeleteArticle(@Param("listArticle") ArrayList<Integer> listArticle){
//        Map<String,Object> map=new HashMap<>();
//        List<CustomerVo> list1=new ArrayList<>();
//        CustomerVo customerVo1=new CustomerVo(1,"罗遗言文化有限公司",0,1,0,"杰克",new Timestamp(System.currentTimeMillis()),new Timestamp(System.currentTimeMillis()),"13121321","1561651");
//        List<CustomerNeedsVo> list2=new ArrayList<>();
//        CustomerNeedsVo customerNeedsVo1=new CustomerNeedsVo(50.0,145.0,1.5,1.9,"租房办公",1,"A1栋",802);
//        map.put("customerNeedsVo",customerNeedsVo1);
//        map.put("customerVo",customerVo1);

        return ResultData.ok();
    }

    /**
     * 新增文章信息
     * @return
     */
    @RequestMapping(value = "/insertArticle" , method = RequestMethod.POST)
    @ApiOperation(value = "新增文章信息",notes = "新增文章信息",produces="冯弋舟", response = ResultData.class)
    public ResultData InsertArticle(@Param("article") Article article){
//        Map<String,Object> map=new HashMap<>();
//        List<CustomerVo> list1=new ArrayList<>();
//        CustomerVo customerVo1=new CustomerVo(1,"罗遗言文化有限公司",0,1,0,"杰克",new Timestamp(System.currentTimeMillis()),new Timestamp(System.currentTimeMillis()),"13121321","1561651");
//        List<CustomerNeedsVo> list2=new ArrayList<>();
//        CustomerNeedsVo customerNeedsVo1=new CustomerNeedsVo(50.0,145.0,1.5,1.9,"租房办公",1,"A1栋",802);
//        map.put("customerNeedsVo",customerNeedsVo1);
//        map.put("customerVo",customerVo1);
        return ResultData.ok();
    }

}

